package com.fw.common.dao;

import java.util.List;
import java.util.Map.Entry;

import org.hibernate.type.Type;




public interface IBaseDao<M extends java.io.Serializable, PK extends java.io.Serializable> {
	
		public PK save(M model);

	    public void saveOrUpdate(M model);
	    
	    public void update(M model);
	    
	    public void merge(M model);

	    public void delete(PK id);

	    public void deleteObject(M model);

	    public M get(PK id);
	    
	    public Integer countAll();

	    public List<M> listAll();

	    public List<M> listAll(int pn, int pageSize);
	    
	    public List<M> pre(PK pk, int pn, int pageSize);
	    public List<M> next(PK pk, int pn, int pageSize);
	    
	    boolean exists(PK id);
	    
	    public void flush();
	    
	    public void clear();
	    
	    public Long getId(String hql, Object... paramlist);
	    
	    public <T> List<T> findByHql(String hql,Integer pagenum,Integer pageSize,Object...params);
	    
	    public <T> List<T> findByHql(String hql,Object...params);
	    
	    public <T> List<T> findByHql(String hql);
	    
	    public <T> List<T> findBySql(final String nativeSQL, final int pn, final int pageSize,
	            final List<Entry<String, Class<?>>> entityList, 
	            final List<Entry<String, Type>> scalarList, final Object... paramlist);
	    
	    
	    
}
